/*前端文章列表*/

import request from '@/utils/request'
import { baseUrl } from '@/config/env';

//获取文章详情
export const articleDetail = (id) => {
  return request({
    url: `${baseUrl}/rest/article/detail/${id}`,
    method: 'get',
  })
}

/*
* @name 发表评论
* @params articleId 文章id
* @params parentId 回复的评论id,如果是发表评论不传
* @params content 评论内容
*/
export const publishComment = (articleId,parentId,content) => {
  return request({
    url:baseUrl+'/rest/comment/editItem',
    data:{
      articleId,
      parentId,
      content
    },
    method:'post'
  })
}

/*
*@name 点赞
*@params id 回复或评论的id
*@params status 1赞 2取消赞
*/
export const praise = (id,status) => {
  return request({
    url:`${baseUrl}/rest/comment/praise/${id}/${status}`
  })
}

/*
*@name 获取文章评论
*@params articleId 文章id
*@params page 请求页
*@params limit 请求每页数
*/
export const commentList = (articleId,page,limit) => {
  return request({
    url:`${baseUrl}/rest/comment/list/${articleId}`,
    params:{
      page,
      limit
    },
    method:'get'
  })
}


